<script>
	import { useUserStore } from '@/store/modules/useUserStore';
	import { getHost } from '@/utils/common/index';
	import request from '@/utils/common/request/index';
	import { useSetThemColor, useGetThemColor } from '@/hooks/useGetThemColor.js';
	import { useGlobalNetworkImageStore } from '@/store/modules/useGlobalNetworkImage.js';

	export default {
		setup() {
			request({ url: '/api/shopqjpz', errorAction: false }).then(res => {
				const data = res.footer;
				useSetThemColor(data.iconFontColor, data.auxiliaryColor);
				const globalNetworkImageStore = useGlobalNetworkImageStore();
				globalNetworkImageStore.setData({
					MoneyTopImg: data.MoneyTopImg,
					personMoneyImg: data.personMoneyImg,
					personTopImg: data.personTopImg,
					phbTopImg: data.phbTopImg,
					teamTopImg: data.teamTopImg,
				})
			});
		},
		onLaunch() {},
		onShow() {
			this.getUserInfo();
		},
		onError(e) {
			console.log(e);
		},
		globalData: {
			...getHost()
		},
		methods: {
			getUserInfo() {
				const token = uni.getStorageSync('token');
				if (token) {
					const userStore = useUserStore();
					request({ url: '/api/uinfo', errorAction: false }).then(res => {
						userStore.setData(res);
					});
				}
			},
		},
	};
</script>

<style lang="scss">
	/*每个页面公共css */
	@import './static/style/base.scss';
	/*自定义图标库需要引入的样式*/
	@import "@/static/iconfont/tabbar/iconfont.css";
	/*uview-plus需要的样式*/
	@import "@/uni_modules/uview-plus/index.scss";
</style>